import cv2
import numpy as np

# 图像的融合
# 不是简单的加法了，相当于拿图片做了线性运算，new_img = img1 * w1 + img2 * w2 + bias

cat = cv2.imread('./images/cat.jpg')
dog = cv2.imread('./images/dog.jpg')

new_cat = cv2.resize(cat, (dog.shape[:-1][::-1]))

# 相当于res = new_cat * 0.4 + dog * 0.6 + 0
res = cv2.addWeighted(new_cat, 0.6, dog, 0.4, 0)

# cv2.imshow('cat_dog', np.hstack((new_cat, dog, res)))
cv2.imshow('cat_dog', res)

cv2.waitKey(0)
cv2.destroyAllWindows()
